<template>
    <div class="main">
        <div class="top">
            <img src="../assets/bar_top.png" alt="" style="width:100%;height:100%" v-if="barTopFlag">
        </div>
        <div class="content">
            <div class="content_item" v-for="(item,index) in barItem" :key="index" :class="{active:barIndex==index}"  @click="jumpTo(item.router,index)">
                {{item.value}}
                <div :class="{leftBlue:barIndex==index}"></div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    props:{
        barItem:Array,
        barTopFlag:{
            type:Boolean,
            default:true,
        }
    },
    data(){
        return{
            barIndex:0,
        }
    },
    methods:{
        jumpTo(router,index){
            this.barIndex=index
            console.log(this.barIndex);
            this.$router.push(router);
        }
    }
}
</script>
<style scoped>
.main{
    width: 100%;
    height: 100%;
}
.top{
    width: 100%;
    height: 75px;
}
.content_item{
    /* padding-bottom:27px; */
    width: 280px;
    height: 55px;
    opacity: 1;
    padding-top: 23px;
    font-size: 20px;
    font-family: Noto Sans SC;
    font-weight: 400;
    text-align: center;
    color: rgba(187,187,187,1);
    margin: 0 auto;
    border-bottom: 1px solid rgba(230, 230, 230, .8);
    transition-duration: 0.4s;
    position: relative;
}
 .content_item:hover{
    color: rgba(51,170,255,1);
    /* border-left: 8px rgba(51,170,255,1) solid; */
    cursor: pointer;
}

.active{
    color: rgba(51,170,255,1);
    /* border-left: 8px rgba(51,170,255,1) solid; */
} 
.leftBlue{
    position: absolute;
    width: 8px;
    height:40px;
    background-color: rgba(51,170,255,1);
    top: 20px;
    color:rgba(51,170,255,1);
    transition-duration: 0.4s;
}
</style>